name1 = str(raw_input("Enter 5 names: "))
name2 = str(raw_input())
name3 = str(raw_input())
name4 = str(raw_input())
name5 = str(raw_input())
names = [name1, name2, name3, name4, name5]
print "The names are",
for i in range (0, 5):
    print names[i],
print
names.sort()
print "The names are",
for i in range (0, 5):
    print names[i],
